package decorator.demo1;

/**
 * 装饰者模式.
 *
 * @author GongXincheng
 * @since 2019-09-17 13:29
 */
public class Main {

    public static void main(String[] args) {
        /*
         * 方式1：
         */
        //Component component = new ConcreteDecoratorA(new ConcreteDecoratorB(new ConcreteComponent("GXC")));

        /*
         * 方式2:
         */
        Component component = new ConcreteComponent("GongXincheng");
        component = new ConcreteDecoratorA(component);
        component = new ConcreteDecoratorB(component);
        component.operation();
    }

}
